<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>AUI快速完成布局</title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/footer.css" />
    <link rel="stylesheet" type="text/css" href="../font/iconfont.css" />
    <script src="../font/iconfont.js"></script>


</head>
<body>
  <footer class="aui-bar aui-bar-tab" id="footer">
  <div class="aui-bar-tab-item aui-active footer-tab" tapmode data-name="main" data-url="main.html">
    <!-- <svg class="icon svg-icon" aria-hidden="true">
    <use xlink:href="#iconsk-shouyeweixuanzhong">
    </svg> -->
    <svg class="icon svg-icon" aria-hidden="true">
      <use xlink:href="#iconsk-shouyexuanzhong">
    </svg>
      <div class="aui-bar-tab-label">首页</div>
  </div>
  <div class="aui-bar-tab-item footer-tab" tapmode  data-name="task_center" data-url="task_center.html">
    <svg class="icon svg-icon" aria-hidden="true">
      <use xlink:href="#iconsk-mianfeishiyong">
    </svg>
  <!-- <svg class="icon svg-icon" aria-hidden="true">
  <use xlink:href="#iconsk-mianfeishiyongxuanzhong">
  </svg> -->
      <div class="aui-bar-tab-label">全部</div>
  </div>
  <div class="aui-bar-tab-item footer-tab" tapmode  data-name="member_friend" data-url="member_friend.html">

    <svg class="icon svg-icon" aria-hidden="true">
    <use xlink:href="#iconsk-fenxiangyoujiang-copy">
    </svg>
    <!-- <svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#iconsk-fenxiangyoujiang">
</svg> -->
      <div class="aui-bar-tab-label">邀请</div>
  </div>
  <div class="aui-bar-tab-item footer-tab" tapmode  data-name="task_ing" data-url="task_ing.html">

      <svg class="icon svg-icon" aria-hidden="true">
        <use xlink:href="#iconsk-zhibolishi-copy">
      </svg>
      <!-- <svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#iconsk-zhibolishi">
</svg> -->
      <div class="aui-bar-tab-label">试用进展</div>
  </div>
  <div class="aui-bar-tab-item footer-tab" tapmode data-name="person_center" data-url="person_center.html">
    <svg class="icon svg-icon" aria-hidden="true">
      <use xlink:href="#iconsk-zhanghaoweixuanzhong">
    </svg>
    <!-- <svg class="icon svg-icon" aria-hidden="true">
    <use xlink:href="#iconsk-zhanghaoxuanzhong">
    </svg> -->
      <div class="aui-bar-tab-label">我的</div>
  </div>
  </footer>

</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="./conf/config.js"></script>
<script type="text/javascript" src="./js/common.js"></script>
<script type="text/javascript" src="../script/jquery-1.8.2.min.js"></script>
<script type="text/javascript">
    apiready = function() {
        initEventListenner(); //退出键添加提示框
        var footer = $api.byId('footer');
        var footerH = $api.offset(footer).h;
        api.openFrame({
            name: 'main_frame',
            url: './main_frame.html',
            rect: {
                x: 0,
                y: 0,
                w: 'auto',
                h: api.winHeight - footerH,
            },
            pageParam: {
                wareId: api.pageParam.wareId
            },
            bounces: true
        });

        $("#footer .footer-tab").each(function() {
            $(this).click(function() {
                var name = $(this).attr("data-name");
                var url = $(this).attr("data-url");

                var userInfo = $api.getStorage('userInfo');

                var is_login = userInfo;
                //alert(typeof(is_login));
                //if(typeof(is_login)=="undefined"){

                //alert(JSON.stringify(is_login));return false;
                //alert(is_login.userid);return false;
                if (name == "person_center" || name == "task_ing") {

                    if (typeof(is_login) == "undefined") {
                        api.openWin({
                            name: "login",
                            url: "./login.html",
                            opaque: true,
                            vScrollBarEnabled: false

                        });

                    }
                }

              //    api.closeToWin({
              //       name: name
              //  });
//打开一个页面并刷新
                api.openWin({
                    name: name,
                    url: url,
                    opaque: true,
                    vScrollBarEnabled: false
                });



            });
        });


    };

    function initEventListenner() {
        api.addEventListener({
            name: 'keyback'
        }, function(ret, err) {
            api.confirm({
                title: '提示',
                msg: '是否退出应用',
                buttons: ['确定', '取消']
            }, function(ret, err) {
                if (ret.buttonIndex == 1) {
                    //$api.clearStorage();
                    api.closeWidget({
                        silent: true
                    });
                }
            });
        });
    };
</script>

</html>
